package apiday04homework;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;

public class CollectionToArray {
    public static void main(String[] args) {
        /*
        Collection<String > c = new ArrayList<>();
        c.add("one");
        c.add("two");
        c.add("three");
        c.add("four");
        System.out.println(c);

        String[] array = c.toArray(new String[6]);
        System.out.println(Arrays.toString(array));;

         */
        Collection<String> c = new ArrayList<>();
        c.add("one");
        c.add("two");
        c.add("three");
        c.add("four");
        c.add("five");
        System.out.println(c);

        String[] arr = c.toArray(new String[3]);
        System.out.println(Arrays.toString(arr));
    }
}
